package com.esri.core.map;

import com.esri.core.internal.util.d;
import com.esri.core.symbol.Symbol;
import java.io.Serializable;
import java.io.StringWriter;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class LabelingInfo implements Serializable {
    private static final String h = "where";
    private static final String i = "{\"type\":\"esriTS\",\"font\":{\"size\":14},\"color\":[0,0,255,255],\"xoffset\":0.0,\"yoffset\":0.0,\"width\":0.0,\"height\":0.0,\"angle\":0.0}";
    private static final long serialVersionUID = 1;
    LabelPlacement a;
    String b;
    boolean c;
    Symbol d;
    double e;
    double f;
    String g;

    public LabelPlacement getLabelPlacement() {
        return this.a;
    }

    public void setLabelPlacement(LabelPlacement labelPlacement) {
        this.a = labelPlacement;
    }

    public String getLabelExpression() {
        return this.b;
    }

    public void setLabelExpression(String str) {
        this.b = str;
    }

    public boolean isUseCodedValues() {
        return this.c;
    }

    public void setUseCodedValues(boolean z) {
        this.c = z;
    }

    public Symbol getSymbol() {
        return this.d;
    }

    public void setSymbol(Symbol symbol) {
        this.d = symbol;
    }

    public double getMinScale() {
        return this.e;
    }

    public void setMinScale(double d) {
        this.e = d;
    }

    public double getMaxScale() {
        return this.f;
    }

    public void setMaxScale(double d) {
        this.f = d;
    }

    public String getWhere() {
        return this.g;
    }

    public void setWhere(String str) {
        this.g = str;
    }

    public static LabelingInfo fromJson(JsonParser jsonParser) throws Exception {
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            return null;
        }
        LabelingInfo labelingInfo = new LabelingInfo();
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("labelPlacement".equals(currentName)) {
                labelingInfo.a = LabelPlacement.getLabelPlacement(jsonParser.getText());
            } else if ("labelExpression".equals(currentName)) {
                labelingInfo.b = jsonParser.getText();
            } else if ("useCodedValues".equals(currentName)) {
                labelingInfo.c = Boolean.parseBoolean(jsonParser.getText());
            } else if ("symbol".equals(currentName)) {
                labelingInfo.d = d.h(jsonParser);
            } else if ("minScale".equals(currentName)) {
                labelingInfo.e = Double.parseDouble(jsonParser.getText());
            } else if ("maxScale".equals(currentName)) {
                labelingInfo.f = Double.parseDouble(jsonParser.getText());
            } else if (h.equals(currentName)) {
                labelingInfo.g = jsonParser.getText();
            } else {
                jsonParser.skipChildren();
            }
        }
        return labelingInfo;
    }

    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a = d.a(stringWriter);
        a.writeStartObject();
        LabelPlacement labelPlacement = this.a;
        if (labelPlacement != null) {
            a.writeStringField("labelPlacement", labelPlacement.getValue());
        }
        String str = this.b;
        if (str != null) {
            a.writeStringField("labelExpression", str);
        }
        a.writeBooleanField("useCodedValues", this.c);
        a.writeFieldName("symbol");
        Symbol symbol = this.d;
        if (symbol != null) {
            a.writeRawValue(symbol.toJson());
        } else {
            a.writeRawValue(i);
        }
        a.writeNumberField("minScale", this.e);
        a.writeNumberField("maxScale", this.f);
        a.writeStringField(h, this.g);
        a.writeEndObject();
        a.close();
        return stringWriter.toString();
    }

    public int hashCode() {
        String str = this.b;
        int hashCode = ((str == null ? 0 : str.hashCode()) + 31) * 31;
        LabelPlacement labelPlacement = this.a;
        int hashCode2 = hashCode + (labelPlacement == null ? 0 : labelPlacement.hashCode());
        long doubleToLongBits = Double.doubleToLongBits(this.f);
        long doubleToLongBits2 = Double.doubleToLongBits(this.e);
        int i2 = ((((hashCode2 * 31) + ((int) (doubleToLongBits ^ (doubleToLongBits >>> 32)))) * 31) + ((int) (doubleToLongBits2 ^ (doubleToLongBits2 >>> 32)))) * 31;
        Symbol symbol = this.d;
        int hashCode3 = (((i2 + (symbol == null ? 0 : symbol.hashCode())) * 31) + (this.c ? 1231 : 1237)) * 31;
        String str2 = this.g;
        return hashCode3 + (str2 != null ? str2.hashCode() : 0);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            LabelingInfo labelingInfo = (LabelingInfo) obj;
            String str = this.b;
            if (str == null) {
                if (labelingInfo.b != null) {
                    return false;
                }
            } else if (!str.equals(labelingInfo.b)) {
                return false;
            }
            LabelPlacement labelPlacement = this.a;
            if (labelPlacement == null) {
                if (labelingInfo.a != null) {
                    return false;
                }
            } else if (!labelPlacement.equals(labelingInfo.a)) {
                return false;
            }
            if (Double.doubleToLongBits(this.f) == Double.doubleToLongBits(labelingInfo.f) && Double.doubleToLongBits(this.e) == Double.doubleToLongBits(labelingInfo.e)) {
                Symbol symbol = this.d;
                if (symbol == null) {
                    if (labelingInfo.d != null) {
                        return false;
                    }
                } else if (!symbol.equals(labelingInfo.d)) {
                    return false;
                }
                if (this.c != labelingInfo.c) {
                    return false;
                }
                String str2 = this.g;
                if (str2 == null) {
                    if (labelingInfo.g != null) {
                        return false;
                    }
                } else if (!str2.equals(labelingInfo.g)) {
                    return false;
                }
                return true;
            }
            return false;
        }
        return false;
    }
}
